let mysql=require('mysql');
let contion=mysql.createConnection({
    host     : '127.0.0.1',
    user     : 'root',
    port:"3306",
    password : 'root',
    database : 'newdb'
});

contion.connect();
//console.log(contion);
let sql="INSERT into `user`(`u_name`,`u_age`,`u_sex`,`u_create`,`u_update`) VALUES('xx','18','xx','"+getTime()+"','"+getTime()+"')"
contion.query(sql,(err,data)=>{
    console.log(err);

})
let sql1="UPDATE `newdb`.`user` SET `u_age` = 20, `u_update` = '"+getTime()+"' WHERE `u_id` = 5";
contion.query(sql1,(err,data)=>{
    console.log(err);

})
let sql2="DELETE FROM `newdb`.`user` WHERE `u_id` = 1";
contion.query(sql2,(err,data)=>{
    console.log(err);
})
let sql3="SELECT * FROM `newdb`.`user`limit "+getPage(0,3)+","+3+" "
console.log(sql3);
contion.query(sql3,(err,data)=>{
    console.log(data);
})
contion.end();
function getTime(){
    let nowTime=new Date().toLocaleString();
    return nowTime;
}

function getPage(page,num){
    let lnum=(page-1)*3
    return lnum;
}
